home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 1
/
Cream of the Crop 1.iso
/
DIAG
/
NEED48.ARJ
/
NEED.PRI
< prev
next >
Wrap
Text File
|
1992-01-09
|
62KB
|
2,113 lines
NEED, AVOID AND SNIFF 4.8
Last updated by Roedy Green on 1992 January 09
PURPOSE
NEED.COM, AVOID.COM, and SNIFF.COM are a trio of utilities for
ensuring the environment is friendly before continuing. They will
test the waters for and report back on such things as:
1. Is DESQview running?
2. Is there sufficient conventional, extended and expanded RAM?
3. Is there sufficient free disk space?
4. Are the necessary DOS utilities loaded like QEMM, SHARE, and
BTRIEVE?
5. Do you have a sufficiently powerful CPU? and NPX (numeric
co-processor)?
6. In this the right day of the month, or day of the week to
run this job?
You tell NEED what you want, then it does all the tests then returns a
simple GO/NO-GO ERRORLEVEL you can test. If it is 0 all is ok. If it
is 1, one or more of the requirements failed.
Since MASM source code is provided to registered owners, (see the end
of this document for information on registering) and since it was
written very modularly, it is very easy to cannibalize routines from
it to include in your own code so long as the code is not used for
military purposes.
NEED, AVOID and SNIFF are copyrighted but may be copied freely and
used for any purpose but military. See the end of this document on
how to register if you want the latest version or the MASM source
code.
TYPICAL USE
NEED and AVOID are a complementary pair of utilities. NEED is for
telling what you WANT, and AVOID is for telling what you DON'T WANT.
SNIFF is just for finding out what's out there, without any
preconceived notion of how it should be.
NEED DESQview DOS3.3- 80386! C:3MB
If Errorlevel 1 GoTo Trouble
DESQview means you must be running under DESQview.
DOS3.3- means you need DOS 3.3 or lower.
80386! means you must have an 386 processor, no more no less.
C:3MB means you must have at least 3 MB of free disk space on
drive C:.
AVOID DESQview DOS3.3- 80387!
If Errorlevel 1 GoTo Trouble
DESQview means you must be NOT running under DESQview.
DOS3.3- means you cannot run on DOS 3.3 or lower.
80387! means you program will not work if there is an 80387 numeric
co-processor present.
SNIFF DESQview DOS CPU C:
Rem Sniff does not use the errorlevel.
DESQview means is DESQview is running?
DOS means what version of DOS is running?
CPU means what kind of CPU do you have?
C: means how much space is left on drive C:?
SUFFIXES
Just skim this section on first reading. It will make a lot more
sense later once you have seen some more examples.
Some parameters may have a trailing + ! or -.
+ means "and up" as in "DOS3.3+"
- means "and lower" as in "DOS3.3-"
! means "this and only this" as in "DOS3.3!"
If you don't specify a suffix, both NEED and AVOID presume !.
However, for capacity-type words such as /EXP:400K, NEED presumes +.
/YEAR:1991, /MONTH:12 and /DAY:31 have a default suffix of !. It
never hurts to override the default. Using explicit suffixes will
make your BAT files easier to understand. The default suffixes are
shown with the documentation on each possible parameter.
In other words:
NEED DOS3.3
means the same as:
NEED DOS3.3!
means you want JUST DOS 3.3 and nothing else will do.
where:
NEED DOS3.3+
means you want DOS 3.3 or higher.
NEED DOS3.3-
means you want DOS 3.3 or earlier.
Similarly:
AVOID DOS4.01
means the same as:
AVOID DOS4.01!
means you want to avoid DOS 4.01,
but all other versions are acceptable.
AVOID DOS4.01+
means you want to avoid DOS 4.01 and all later versions.
AVOID DOS4.01-
mean you want to avoid DOS 4.01 and all earlier versions.
The three suffixes + - and ! make sense for version-type parameters.
None of the suffixes make sense for a parameter like QEMM which is
either present or not. However, suffixes do apply to CPU and NPX-type
parameters like 80386DX and 80387 which can be ordered by power. e.g.
NEED 80286+ means you want an 80286 or more powerful CPU.
For capacity-type parameters like C:40MB, only + makes sense, which is
the default anyway. However, in AVOID, only C:40MB- makes sense.
This all sounds much more confusing than it really is. Just
experiment, you will catch on pretty quickly.
Is all that on suffixes just too confusing? Rejoice. SNIFF ignores
all your suffixes. No matter what you do with them it will accept
them.
GENERAL SYNTAX RULES
On first reading, just skim this section.
K or KB means "measured in 1024 byte units". For example, to insist
on having at least 400 kilobytes (40,960 bytes) of free RAM type:
NEED RAM:400KB
M or MB means "measured in megabyte (1024x1024) units". For example,
to insist on 20 megabytes (20,971,520 bytes) of free space on drive
C:, type:
NEED C:20MB+
The use of forward slash / to introduce a switch is optional. You can
say:
NEED /DESQview
or
NEED DESQview
If there are no separating slashes, then parameters must be separated
by blank space. No spaces are allowed within a single parameter
however.
The command line is case insensitive. You can put letters in any
combination of upper and lower case you like.
Numbers may contain optional commas. The commas are ignored. Numbers
may also contain decimal points.
In Norway, home of the world's most enthusiastic beta testers, the
roles of comma and decimal point are reversed. In general the
"thousands separator" and "decimal separator" are taken from the DOS
Country.Sys information, so comma and decimal are different dependent
on your country. Either the comma or point may be used in version
type parameters such as /DOS4,01 or /DOS4.01.
Parameters have a short form and sometimes various alias and long
forms. Intermediate length names are not allowed. If I did allow
intermediate forms, then later I might later implement a new parameter
that could break existing BAT files by rendering existing use of a an
intermediate length parameter ambiguous.
You can put as many parameters as will fit on the command line. There
is only one output -- the ERRORLEVEL which is either 0 for GO, 1 for
NO GO, or 4 for syntax error. The program will display messages for
each test passed or failed. They can be suppressed with >NUL:. If
you want to have individual control for recovery purposes, test only
one parameter at a time. The utility is around 8K, so it will not
take long to load it multiple times, especially if you have caching.
Any syntax error beckons a help display with a brief summary of the
syntax.
There are three kinds of commands:
1. Plain words that test for the existence of something. e.g.
386MAX 8086 PCDOS EXP
2. Capacity words with a colon followed by a number: e.g.
RAM:40K C:2MB EXP:400,000
3. Version words followed directly by a number without a colon:
e.g. DOS4.01 PCDOS5.0
Note that some words come in more than one flavour. For example,
/EXP tests for the existence of a expanded memory manager, but
/EXP:400,000 checks that a certain amount for free expanded RAM is
available. /PCDOS checks that any version of IBM PC DOS is running,
but /PCDOS3.1 tests that version 3.1 is running.
SNIFF is much more laid back than NEED or AVOID. You may optionally
leave out the version or the capacity so:
RAM RAM: RAM:4K C C: C:100K DOS DOS4.1+
are all equally acceptable to SNIFF.
NOTE
The suffix shown after each word following is the DEFAULT SUFFIX you
will get if you don't specify a suffix.
PARAMETERS
386! You require an 80386-DX cpu.
386MAX! You must be running with the 386MAX memory manager
active.
486! You require an 80486-DX cpu.
4DOS! You must be running under 4DOS. If you are
running under COMMAND.COM under 4DOS this will
still be considered as running under 4DOS.
80186! You require an 80186 cpu.
80188! You require an 80188 cpu.
80286! You require an 80286 cpu.
80287! You need an 80287 numeric coprocessor.
80386! You require an 80386-DX cpu.
80386DX! You require an 80386-DX cpu.
80386SX! You require an 80386-SX cpu.
80387! You require an 80387 numeric coprocessor.
80486! You require an 80486-DX cpu.
80486DX! You require an 80486-DX cpu.
8086! You require an 8086 cpu.
8087! You require an 8087 numeric coprocessor.
8088! You require an 8088 cpu.
A20 You require that A20 addressing line be active for
high memory access.
ANSI You require that ANSI.SYS be loaded in your
CONFIG.SYS. Some other drivers may partially
simulate ANSI.SYS, and will appear to NEED/AVOID
as if they are ANSI.SYS. If you use redirection
e.g.
SNIFF ANSI > TEMP.TXT
under DOS versions prior to 4.0, then the ANSI
test will not work. Under old versions of DOS,
Windows in real mode also interferes with the ANSI
test.
APPEND You require the DOS APPEND command to be active.
ASSIGN You require the DOS ASSIGN command to be active.
AT You require a AT style BIOS. See /BIOS.
BIOS+ NEED BIOS is a synonym for NEED EXOTIC+. AVOID
BIOS is a synonym for AVOID EXOTIC-. SNIFF BIOS
means "What kind of BIOS do I have?" Exotic, XT,
AT or PS2? The test depends on the machine id
byte at location F000:FFFE in the ROM BIOS. If
your machine is a non-standard "exotic" clone,
SNIFF cannot tell which kind of BIOS you have.
SNIFF will report the non-standard machine-id
code. Please report it to me and details about
your machine, so I can teach SNIFF to recognize
it. BIOSes are ranked so that you can say:
NEED XT+
meaning EXOTICs will not do, but XT, AT or PS2 is
ok. When NEED says you have an AT, it simply
means you have an AT BIOS. This has nothing
whatsoever to do with your CPU. It might be a
286, SX, 386 or 486. When it says you have an XT
BIOS, you might even have even have an Intel
Inboard 386. If it says you have a PS2, there is
a good chance you don't have a PS/2 microchannel
machine. You simply have a BIOS of the style used
by PS/2 computers.
BTRIEVE You require the Novell BTRIEVE Btree indexed file
manager to be loaded.
C:3MB+ There must be at least 3 MB of FREE disk space on
drive C:. You may use drives A: through Z:. Note
SNIFF C: will tell you the amount of UNUSED, FREE,
UNALLOCATED, AVAILABLE space on your drive. IT
DOES NOT REPORT THE *TOTAL* AMOUNT OF SPACE ON
YOUR DRIVE. Only unallocated disk space is of any
interest or use to programs.
CPU+ This does not make much sense in NEED or AVOID
though you may use it. In SNIFF it means "What
kind of CPU do I have?"
D:1+ There must be at least one free byte of disk space
on drive D:. This could be used to detect the
presence of drive D:
DAY:31! means you can only run this program on the 31st of
the month. /DAY:28+ means you can only run it on
the 28th, 29th, 30th or 31st of the month. Beware
of using /DAY:31 since in many months it never
happens.
DESQ You must be running under DESQview.
DESQ2.31! You must be running under DESQview version 2.31.
DESQview You must be running under DESQview.
DESQview2.31! You must be running under DESQview version 2.31.
DOS10.0! You must be running in the OS/2 compatibility box
which is considered as DOS 10.0+
DOS2.1! You must be running under DOS 2.10.
DOS3! You must be running under DOS 3.00.
DOS3.00! You must be running under DOS 3.00.
DOS3.31! You must be running under DOS 3.31
DOS5.0! You may specify any version number, not just those
listed here. NEED/AVOID can tell DOS4.00 and
DOS4.01 apart even though DOS4.01 lies about its
true identity. In theory, this is impossible.
How does NEED do it? Register and peek at the
source code.
DPMI You must be running with a DOS Protected Memory
Interface manager (DPMI). There is no matching
DPMI:40K test for determining how much DPMI RAM is
available since running such a test would require
entering protected mode. The only time this test
will ever come up true is if you are running under
Windows 3.0 in enhanced mode.
DRDOS You must be running under Digital Research DRDOS,
any version. Both DRDOS and DRMDOS are treated as
equivalent.
DRDOS5.0! You must be running under DRDOS 5.0.
You can specify any version. Internally DRDOS
pretends to be Compaq DOS 3.31.
DV You must be running under DESQview.
DV2.31 You must be running under DESQview version 2.31.
DX! You require an 80386-DX cpu.
EMM You must have an expanded memory manager active.
EMM is an alias for EXP.
EMM:100,000+ You must have 100,000 free bytes of EMM RAM
EMM is an alias for EXP. See /EXP for more
details.
EMS You must have an expanded memory manager active.
EMS is an alias for EXP.
EMS:1MB+ You must have 1 megabyte of free expanded RAM.
EMS is an alias for EXP.
ENV:300+ You must have 300 or more FREE bytes in the SET
environment. ENV is an alias for ENVIRONMENT.
ENVIRONMENT:1K+ You must have 1024 (1K) or more FREE bytes in the
SET environment. DOS tacks the current program
name onto the end of the SET environment. SET
considers the area used by the program name as
free. So you should ask for a little extra to
give DOS room. Please note SNIFF /ENVIRONMENT
will NOT report the total size of your environment
-- just the REMAINING FREE SPACE. This is what is
of interest to programs wanting to fill it up with
SET commands.
EXOTIC AVOID EXOTIC means stay away from non-standard
BIOSes. See /BIOS.
EXP You must have an expanded memory manager active.
EXP is an alias for EXPANDED.
EXP:400K+ You must have 400 or more free bytes of expanded
RAM controlled by a LIM EMS EMM memory manager.
EXP is an alias for EXPANDED.
EXPANDED You must have an expanded memory manager active.
EXPANDED:70K+ You must have 70 K of free expanded RAM.
Note SNIFF /EXPANDED will tell you the amount of
UNUSED, FREE, UNALLOCATED, AVAILABLE expanded RAM.
IT DOES NOT REPORT THE *TOTAL* AMOUNT OF EXPANDED
RAM. Only unallocated RAM is of any interest or
use to programs.
EXT:3MB+ You must have 3 or more megabytes of free extended
RAM. EXT is an ALIAS for EXTENDED.
EXTENDED:100K+ You must have 100K or more free extended RAM. The
RAM can be any type -- XMS, VDISK or INT 15. If
you want to measure only the modern XMS RAM, use
/XMS. Note SNIFF /EXTENDED will tell you the
amount of UNUSED, FREE, UNALLOCATED, AVAILABLE
extended RAM. IT DOES NOT REPORT THE *TOTAL*
AMOUNT OF EXTENDED RAM. Only unallocated RAM is
of any interest or use to programs. Often all
your extended RAM has been converted to EXPANDED
so that explains why there is none left.
FRIDAY! It must be Friday. Sunday is considered the first
day of the week if you use + and - suffixes.
HELP Displays a short syntax summary. You need this
manual though to get all the possible commands.
PLEASE DO NOT PASS THIS PROGRAM ON WITHOUT THIS
MANUAL. It is too complex for on-line help only.
If you vandalize this package and pass it on
without the manual, I might even be tempted to do
something illegal and unpleasant to you.
KEYB You must have KEYB installed. It may or may not
be configured to a non-American layout.
LAN You must be actively attached to a LAN. It works
by testing to see if any of drives C: to Z: are
remote. CD-ROM drives are detected and specially
handled so they do not count as LAN drives.
LIM You must have an expanded memory manager active.
LIM is an alias for EXP.
LIM:0.7MB+ You must have 0.7 MB of free expanded RAM.
LIM is an alias for EXP.
MONDAY! It must be Monday. Sunday is considered the first
day of the week if you use + and - suffixes.
MONTH:12! This means you may only run this program in
December. /MONTH:2- means you could only run it
in January or February. /MONTH:10+ means you can
only run it in October to December.
MOUSE! You must have a mouse operational.
MSDOS You must currently be running some version of
Microsoft's MS DOS. See PCDOS for warnings on
difficulty telling PC and MS DOS apart. When it
does not matter, just use the /DOS4.01 command.
MSDOS3.3! You must currently be running Microsoft's version
of MS DOS version 3.3.
NCACHE You require Norton NCACHE disk cacher to be loaded
-- possibly as a device driver in config.sys or as
a TSR in autoexec.bat.
NETBIOS You must have a NETBIOS type LAN active.
NPX You must have some sort of numeric processor
installed. There are individual commands for the
various types: /8087 /80287 /80386 and /80486.
Note the /80486 cpu always has a built in
processor. In SNIFF /NPX just displays your
numeric coprocessor type.
OR Allows you to do several groups of tests. Only
one group needs to succeed to be considered as
overall success: e.g.
NEED 80387 80386 OR 80486
This means you must have BOTH and 80387 and an
80386, OR an 80486 which has a built in numeric
co-processor. See further hints later.
PCCACHE You require Central Point's PCTools PCCACHE disk
cacher to be loaded. Note there is no dash in the
name. It has been tested with version 4.4 and
6.0. I do not yet know if it works with other
versions, in particular 7.1.
PCDOS You must currently be running some version of IBM
PC DOS. NEED has a difficult time telling PC DOS
apart from MS DOS, and in many cases will confuse
them. NEED works by asking DOS which drive is the
Boot drive. In versions prior to 4.00, DOS does
not know, so NEED just guesses the same as the SET
COMSPEC=C:\DOS\COMMAND.COM:. Then it looks for
the hidden, system read-only file called
IBMBIO.COM. If it finds it, it presumes PCDOS,
otherwise it assumes MSDOS. You can see the many
ways this test could fail to operate properly.
1. Olivetti MS DOS calls their file IBMBIO.COM
instead of IO.SYS.
2. If you booted from A: with PCDOS 3.3, and set
your COMSPEC to C:, NEED will not know to look on
your floppy.
3. You have installed DRDOS on top of your PCDOS.
It leaves the IBMBIO.COM file in place.
Normally you should use plain /DOS5.0 when it does
not matter if you have PC or MS DOS. I have
discovered the following MSDOS versions masquerade
as PCDOS: Compaq, Wyse, DRDOS, Corona, possibly
Northgate. See /MSDOS.
PCDOS4.00! You must currently be running version 4.00 of
IBM's PC DOS.
PERI You must be running under the Periscope debugger.
PERI5.1 You must be running under Periscope 5.1
PERISCOPE You must be running under the Periscope debugger.
PERISCOPE5.1 You must be running under Periscope 5.1. Works
for any version.
PS2 You must have a PS/2 style BIOS. Note there is NO
slash! This test is NOT for detecting
microchannel computers. See /BIOS.
QEMM You must be running under the control of the QEMM
memory manager from Quarterdeck.
QRAM You must be running under the control of the QRAM
memory manager from Quarterdeck.
RAM:500K+ There must be at least 500K free conventional RAM.
NEED automatically adjusts the figure to be what
you would have if NEED were not running. NEED
gives you the size of the largest free chunk into
which you could load a program -- not the
aggregate size of all the little free RAM
fragments. Note SNIFF /RAM will tell you the
amount of UNUSED, FREE, UNALLOCATED, AVAILABLE
conventional RAM. IT DOES NOT REPORT THE *TOTAL*
AMOUNT OF conventional RAM. Only unallocated RAM
is of any interest or use to programs. Often all
your conventional RAM has been eaten up by TSRs,
so that explains why there is so little left.
REAL You must be running in REAL mode, i.e. not under a
virtual memory manager or any DOS extender that
runs in protected mode. If you were running under
Windows in /r mode, but had QEMM working, you
would be in virtual mode. If you were running
under Windows standard or enhanced mode you would
be in virtual mode. If your run in the OS/2
compatibility box, you will be in REAL mode, even
if you have an 80386 or 80486. If your are
running under QEMM, you will always be in virtual
mode.
SATURDAY! It must be Saturday. Sunday is considered the
first day of the week if you use + and - suffixes.
SHARE You must have DOS SHARE active. If you are
running in Windows Enhanced mode, Windows acts
like SHARE to help the various multi-processing
tasks stay out of each other's hair, and so it
will appear as if the SHARE utility itself is
loaded.
SLOW SLOW forces any sensitive subsequent tests to be
done the slow duddy, inaccurate, mundane, Windows
way. You would use this if, for example, you had
an ancient version of QEMM that was interfering
with the CPU type determination tests. NEED
automatically uses the SLOW tests when it detects
Windows in enhanced mode. If your virtual monitor
is interfering with a test and exploding, try
using SLOW. e.g.
NEED SLOW SX
SMARTDRIV! You require that the SMARTDRIV.SYS caching program
be loaded. Other brands of cacher that mimic
SMARTDRV may give false positives, however NCACHE
and PCACHE will not since there are special checks
for them.
SUNDAY! It must be Sunday. Sunday is considered the first
day of the week if you use + and - suffixes.
SX! You require an 80386-SX cpu.
THURSDAY! It must be Thursday. Sunday is considered the
first day of the week if you use + and - suffixes.
TUESDAY! It must be Tuesday. Sunday is considered the
first day of the week if you use + and - suffixes.
V20! You require a NEC V20 cpu.
V30! You require a NEC V30 cpu.
VCPI You must be running under the control of a Virtual
Control Program Interface (VCPI). If you have
QEMM or 386MAX you will see VCPI active. It will
remain active under Windows real and standard
versions but will disappear under Windows enhanced
since Windows enhanced mode cannot tolerate
programs that use protected mode, unless they are
specially coded to run by Windows rules.
VCPI:500K+ Your require at least 500K free RAM under the
control of a Virtual Control Program Interface
(VCPI). By now you get the idea. SNIFF /VCPI
reports FREE VCPI RAM, not total VCPI RAM. A
program like DESQView might take it all to parcel
out to support its windows.
WEDNESDAY! It must be Wednesday. Sunday is considered the
first day of the week if you use + and - suffixes.
WEEKDAY+ This does not make much sense in NEED or AVOID,
but in SNIFF it can be used to display the day of
the week e.g. Sunday.
WIN2! You must me running under Windows 386 version 2.x
WIN3E! You must be running under Windows 3 in Enhanced
mode. When you are in enhanced mode, you will
find the DPMI manager becomes active, and Windows
suddenly thinks it is impertinent to ask about
VCPI. If you do, she will give you a protection
violation. SNIFF just says VCPI is not there if
WIN3E is present.
WIN3R! You must be running under Windows 3 in Real mode.
If you have QEMM running the Microsoft Windows
test reports Windows in real mode as if it were in
standard mode. Since the machine is in REAL mode,
you will never see any DPMI protected mode RAM.
WIN3S! You must be running under Windows 3 in Standard
mode. Since the machine is in REAL mode, you
won't see any DPMI protected mode RAM.
WINDOWS+ You must be running under control of some version
of Windows (even version 2 is ok). In SNIFF it
displays the version of Windows you are using if
any.
XMS There must be an XMS extended memory manager
active.
XMS:400K+ There must be at least 400K of free extended RAM
managed by an XMS memory manager. Sniff /XMS
reports only FREE XMS RAM, not total XMS RAM. If
you have less than you think you should, consider
that with QEMM, XMS and EXP memory are drawn from
the same pool. An EXPANDED memory user may have
gobbled up your XMS RAM. Many programs quietly
eat up EXP RAM -- 4DOS, BTRIEVE, . . . If you are
running under DESQView, you control the amount of
XMS RAM available to a window with the [Maximum
Expanded Memory Size in K] option. QEMM treats
XMS and EXP as if they were almost the same.
XT You require an XT style BIOS. See /BIOS.
YEAR:1992! This means you can only run the program in the
year 1992. If you used /YEAR:1992+ you could only
run it starting in 1992 and in subsequent years.
Note you MUST specify /YEAR:1991. You cannot just
say /1991.
Z:10.0MB+ Drive Z must have 10 MB or more free space on it.
TROUBLE SHOOTING
WRONG AMOUNT OF RAM, DISK SPACE, ETC
Many users have reported a "bug" that NEED, AVOID and SNIFF are
calculating the free memory or free disk space incorrectly. These
programs are designed to calculate **FREE** space -- NOT TOTAL SPACE!
In other words they calculate how much room is LEFT.
NEED and AVOID are the advance guard who go in to see if it safe for
more delicate programs to follow. These application programs don't
give two hoots how much RAM you have or how much disk space you have
in total. What they care about is how much RAM or disk space is
AVAILABLE that they can USE.
In addition users are alarmed when SNIFF reports NO free XMS RAM or no
free EXPANDED RAM. Often, the reason there is no FREE RAM, is because
some program is USING all of it. This is good. Otherwise you would
be WASTING it.
Under DESQview no XMS, EXPANDED or EXTENDED memory is available unless
you edited the PIF to tell DESQview to allot some.
Also merely having Extended or Expanded RAM hardware is not enough for
it to be usable by your programs. For expanded RAM you must have an
expanded memory manager of some kind. For extended RAM you must have
an INT 15 or XMS or VDISK style memory manager. Usually the expanded
and XMS drivers are loaded as part of CONFIG.SYS. Int 15 should
supported as part of your AT BIOS. If you don't have an appropriate
memory manager, the memory is not usable and so SNIFF will report 0
bytes available.
CANNED BAT FILES
I have included a sample file called SHOW.BAT that exercises SNIFF to
tell you everything it knows about your machine. You can use that as
a model to create your own works using SNIFF. Make sure SNIFF.Com is
on the path or modify the file to use explicit directory names on
SNIFF.COM.
I have also included a sample file called TSTNEED.BAT that exercises
NEED. You can use it to model your use of NEED.COM. There is also a
file called TSTAVOID.BAT that exercises AVOID.COM.
TRACKING THE CAUSE OF ERRORS
NEED and AVOID are not very helpful in their error messages. If you
are having trouble figuring out what NEED or AVOID are complaining
about, try your tests separately rather than putting many on one line.
However, by looking at which tests on the line it has completed, you
can guess which command it is choking on.
Perhaps you have inserted some invalid space. Particularly watch
/DOS4.01, not /DOS_4.01. Perhaps you have applied a suffix +, ! or -
that does not make sense in that context.
Perhaps you are using one of the parameters that has not been
implemented yet. You might be trying something like /QEMM:5.12.
There IS no version support test for QEMM yet.
Possibly you have found a bug in NEED/AVOID/SNIFF. This is most
likely if you are using an older version of DOS. I personally have
only tested with MS DOS 4.01 and DOS 5.0, though my beta testers have
tried it on quite a variety of machines.
You can try the SLOW parameter if your machine is hanging on the CPU
type determination tests. e.g. try:
NEED /SLOW 486
NEED /SLOW SX
CARE WITH COLONS
Be careful with colons. Sometimes they must be present. Sometimes
they must be absent. Check the list of supported combinations. Note
the following:
NEED DOS4.01 *NOT* NEED DOS:4.01
NEED MSDOS *NOT* NEED MSDOS:
NEED C:40K *NOT* NEED C40K
NEED MOUSE *NOT* NEED MOUSE2.0
NEED EXT:1 *NOT* NEED EXT
INVALID SUFFIXES
You and I may have a disagreement about which suffixes make sense on
which parameters. If NEED rejects your command line, try removing
suffixes. Note the following is ILLEGAL. Even if it were legal, it
would not mean what you think:
NEED DESQview-
Instead, to insist DESQview to be absent, say:
AVOID DESQview
Even though I don't show it in the manual, actually the ! suffix is
always allowed, so the following is LEGAL.
NEED DESQview!
AND VERSUS OR
The most likely error you will make is this:
NEED /80286 /80386DX
This will always fail. What is says is your CPU must be
simultaneously both an 80286 AND and 80386. It cannot, so the test
always fails. All the tests on the line must pass. To get the effect
of 80286 OR 80386 you could handle this in several ways:
NEED 80286 OR 80386DX
If you wanted to include the SX too, you would have to say:
NEED 80286 OR 80386SX OR 80386-DX
You could also handle it by testing one at a time:
NEED 80286! >NUL:
IF NOT ERRORLEVEL 1 GOTO OK
NEED 80386! >NUL:
IF NOT ERRORLEVEL 1 GOTO OK
:TROUBLE
ECHO Neither 80286 nor 80386
...
:OK
ECHO Is an 80286 or an 80386
The >NUL: hides the error messages that NEED would generate. Note the
spelling of >NUL: with one "L". If you said >NULL DOS would try to
direct the output to a file called NULL. On a LAN this might not be
legal.
You could handle it another way -- using AVOID.
AVOID 8086- 80486+
This says avoid any cpu the equivalent of an 8086 or lower, and an
80486 or higher. Anything else should be an 80286, SX or 80386.
You are likely to make a similar same error this way:
NEED Monday Wednesday Friday
That will not work because NEED is so pea-brained it thinks you mean
it must be Monday AND Wednesday AND Friday all at the same time, today
-- which can never happen. You need to say:
NEED Monday OR Wednesday OR Friday
Note that ALL those ORs are needed. You CANNOT say:
NEED Monday Wednesday OR Friday
Dinosaur-brained NEED thinks you mean NEED (Monday AND Wednesday) OR
Friday. Note that NEED does not understand parentheses or the word
"AND" -- just the word "OR".
You can use NEEDs insistence on redundancy to your advantage. If you
say:
NEED C:4MB EXT:1MB OR C:5MB
This means you need 4MB free on C: AND a megabyte free extended RAM,
or failing that 5 MB free on C:, or both. It a good idea to leave a
few extra spaces before and after the word OR to make the meaning
clear to your readers. NEED does not need the extra space.
DESQVIEW
If you are using DESQview, run NEED, AVOID and SNIFF at protection
level 0 (set on the second page of PIF options). NEED does some
tricky instructions to find out what sort of CPU you have, and if you
have the protection turned up DESQview/QEMM will freak.
If you have a very old version of DESQview or QEMM you may have to use
the SLOW parameter.
DESQview will provide no extended, expanded or XMS RAM to a program
running under it unless you set the Maximum Expanded Memory Size in K
on the second page of the CP (change program) screen. That one number
provides a pool of RAM from which expanded or extended RAM can be
carved.
WINDOWS
Windows is full of bugs and interferes in many ways with NEED, SNIFF
and AVOID. I did the best I could to defend these programs against
Window's meddling. I had to revert to some extremely SLOW, inaccurate
tests in place of the normal ones to avoid invoking Window's wrath.
In addition, Windows interferes with ANSI.SYS. Under older versions
of DOS, in REAL mode ANSI.SYS hangs up unless you give it a prod by
hitting a key when NEED asks for a cursor position report during the
ANSI test.
WINDOWS AND HIMEM.SYS
If you use Windows with Himem.Sys, here is what to expect:
real std enhanced
/r /s /3
expanded RAM no no yes
extended RAM yes no yes
XMS yes no yes
VCPI no no no
DPMI no no yes
REAL mode yes yes no
Please note: There is NO VCPI ever and NO DPMI except in /3 enhanced
mode. This is NORMAL. About ten people have reported it as a bug.
WINDOWS AND QEMM
If you use Windows with Quarterdeck's QEMM.Sys, here is what to
expect:
real std enhanced
/r /s /3
expanded RAM yes no yes
extended RAM yes no yes
XMS yes no yes
VCPI yes yes no
DPMI no no yes
REAL mode no no no
Please note: Windows gobbles up all the XMS RAM in /s mode. The XMS
driver is there, but all the RAM is gone. Because QEMM provides both
EMS and XMS from the same pool of RAM, effectively Windows in standard
mode then gobbles up all the expanded RAM as well. QEMM does its
memory mapping magic by using the PAGING (virtual memory) mapping
registers. To do this it puts the machine into virtual 86 mode. That
is why Windows /r (REAL mode) shows up as virtual.
CRASHES
Sometimes NEED, SNIFF and AVOID will just hang up or make the machine
go crazy. In those cases you can try the SLOW parameter to use the
less accurate, slower tests.
For example try:
SNIFF SLOW CPU
NEED SLOW SX+
Here are the tests that most likely might give you trouble if you run
with a meddling virtual monitor (such as Windows, Compaq memory
management, QEMM, 386MAX etc.). A VM is a sort of mother program that
slaps your wrists any time you use "interesting" instructions. What
follows is tech-talk. Don't worry if it makes no sense.
REAL vs Virtual Sniff does an smsw instruction that mother might
not like. Other tests may do a REAL test as a
side effect.
286 vs 386 Sniff used to do an SGDT instruction, but windows
meddled and made everything look like a 286.
Sniff no longer ever uses this test. The code for
it is available as part of the registered version,
as commentary.
SX vs 386 Sniff tries to toggle bit 4 (the ET bit) of
register CR0. If you have an SX, 386 or 486, this
test will be used. This bit tells which kind of
NPX you have.
386 vs 486 Sniff tries to toggle bit 18 (the AC alignment
check bit) in the extended flags register. Some
virtual monitors will not let you. If you have an
SX, 386 or 486, this test will be used.
REPORTING BUGS
The following people helped test out about 15 versions of
NEED/AVOID/SNIFF before we let it loose on the world at large. They
go by the Bix handles of: aGurski, aRog, Blaszczak, bQuerry, bStrauss,
dSparks, Fred.Robinson, gChicares, hGessau, instantel, JeBarr,
lFirrantello, Ligo, M.Love, macbeth, Mike123, mReay, pRoub, rbabcock,
rlis, sSchneider, terjeM, tron and wlMoore. Even more, they helped
write the code and research the code.
After 3.0 went out, these people reported and helped track down more
bugs: avi, making, rCharney, tfrost, tjeffries and yendor.
They found all kinds of problems, especially when testing on older or
oddball machines. There is still a good chance you might get to have
the joy of finding a bug for yourself. If you do, please report it.
PLEASE LABEL FILES WITH YOUR NAME. When you send me code, messages or
bug reports, please label everything with your name and a way to
contact you (e.g. your BIXid) INSIDE THE FILE. I receive so many
downloaded files, I have no way of remembering who sent me what. I
WANT to give you credit.
PLEASE TELL ME ABOUT YOUR MACHINE. There have not been any bugs in
quite a while I could reproduce on my computer or any of the computers
in my office. The bugs you find are most likely specific to your
machine. I need to know as much as possible about your machine so I
can code around whatever is making the code fail. Please tell me at
least: Manufacturer and version of DOS, CPU chip Type, BIOS maker,
anything unusual about your machine. If you have any assembler
debugging experience, please let me know that too.
I have tested all of this code many times. It works fine on MY
machine and on about 25 other people's machines. If it does not work
on yours, it is most likely because there is something different about
your machine and mine. So if you baldly tell me the XXX test does not
work, that gives me no clues to track it down.
To avoid embarrassment, check the notes in this manual on the
parameter you are reporting on and the trouble shooting section. It
might be I deliberately designed the program to behave differently
than you expected, or there is a bug I already know about that I
cannot bypass.
And finally TELL ME WHICH VERSION OF NEED you are using, every time
you report a problem. I don't have records of which versions each of
you are using. I have been putting out sometimes three versions a
day, and you may be reporting a bug that was already fixed, or you may
be reporting an old one that has resurfaced in a new form. To find
out the version just type NEED, SNIFF or AVOID by itself on the
command line.
To make it very clear what the bug is, tell me exactly what you typed
-- preferably only one test on a line, what result came back, and what
result you were expecting. Sometimes people send me long lists of
what look like perfectly valid test results. They forget I don't know
anything about what the results SHOULD look like.
UNFINISHED BUSINESS
/ANSI Windows in real mode has a bug that interferes
with cursor position reporting. This interferes
with the /ANSI test in old versions of DOS under
Windows. If you use redirection, the fallback
ANSI test (only used in old versions of DOS) will
not work.
/SX vs /DX Windows interferes with the normal test so I have
to use a less accurate test that takes an
obscenely long time to run.
/386 vs /486 Windows interferes with the normal test so I have
to use a less accurate test.
/PCDOS vs /MSDOS I have not been able to find a completely reliable
way to tell IBM PC DOS apart from Microsoft MS
DOS. Part of the problem is vendors deliberately
broke the rules to make their products look more
like IBM PC DOS than they were supposed to.
IDEAS FOR FUTURE VERSIONS
/83KEY You have an XT type keyboard
/84KEY You have an AT type keyboard
/102KEY You have a PS/2 type keyboard
/CP:134 Ensures a given code page is loaded.
/FCBS How many free FCBs for opening DOS 1.1 style
files. This might be impossible to code without
interfering with your TSRs.
/MONO IBM Monochrome, Herc, Herc-Plus, EGA or VGA
available -- something capable of emulating mono
text.
/HERC Hercules or Hercules-Plus card present
/HERCPLUS Hercules Plus card present
/INCOLOUR Hercules Incolour card present
/CGA Original IBM CGA card or anything capable of
emulating it, e.g. EGA, VGA
/EGA EGA card present
/VGA VGA card present
/GRAYSCALE Grayscale VGA
/PCKWIK Super PCKwik cache present
CANARY A utility that runs the tests in order of
difficulty. It would run the easy ones first,
then the ones that require greater compatibility.
It would die part way through. Your rank before
death is your canary compatibility rating. You
would use it to test a clone before you bought it.
I would add tests not part of the current suite.
If you have ideas on how to code any of the above, or better tests for
any of the existing NEED commands, please let me know.
MODIFYING NEED AND AVOID
NEED and AVOID are written in MASM. Registered users get the source
code to use as they like. You may simply want to pick through it to
cannibalize ideas or routines for your own programs. You may just
want to satisfy your curiosity how I did some of the tests.
The heavily commented code was written to make this as easy as
possible. In addition, in each routine I give references to textbooks
and essays where I figured out how to write the code, so this can be a
starting point for your own more clever routines.
If you want to add your own tests to NEED, all you need to do is write
an assembler routine that does the test and returns the result in
DX:AX. It may trash any registers.
There are three basic kinds of test:
1. implied: e.g. /DESQview. Your test routines test returns 0
for not present and 1 for present in AX. The implied "level
of presence" desired is 1. Just ahead of the routine you
must fill in a table entry that tells the name of your new
command, the name of your test, and set of flags on which
Suffixes are permitted. You don't have to make any
adjustments to the program, just add your routine.
2. Capacity: e.g. /RAM:604K. In this type your routine returns
the amount of RAM or whatever in DX:AX. The user specifies
the amount of it desired after the colon on the command
line.
3. Version: e.g. /PCDOS4.01 The version number follows the
command name without any separating punctuation. In this
case your routine returns the version number multiplied by
100 in AX. e.g. DOS3.01 becomes 301.
The best way to add a command is just to find a parameter you
understand, similar to the one you want to add, and use that as a
model. You don't have to understand any of the general purpose
parser. Everything you have to do is localized in one place.
You also have to write a display routine that display the result of
your test. There are a number of subroutines you can use to make that
easier. Your display routine expects the value in DX:AX and may trash
any registers it pleases. e.g. it might display "DESQview detected"
when passed 1 in DX:AX.
NEED, AVOID and SNIFF are so similar, they use the same source code.
You simply change one equate called GENERATING, then you can generate
a copy of NEED, AVOID or SNIFF. Usually I do this automatically with
the /D parameter on the OPTASM assembler.
VERSION HISTORY
WHAT'S NEW IN VERSION 4.8
- detects non-standard Phoenix ATs that use FC:81 model id.
WHAT'S NEW IN VERSION 4.7
- BIOS test now works even if the BIOS fails to support the INT 15
equipment determination interrupt properly.
WHAT'S NEW IN VERSION 4.6
- LAN test had a problem with a DOS bug. DOS uses int 2f function
1500 for both detecting CD-ROMS and Graphics.Com. CD-ROM drives
masquerade as LAN drives. I have tried a new method to get around
the bug. Reginald Charney reported this bug.
- Phoenix 486 computers were using a new machine id code, rather than
duplicating one of IBM's. I added code FC 03 as an AT code.
Reginald Charney reported this bug.
WHAT'S NEW IN VERSION 4.5
- 4DOS presence test
WHAT'S NEW IN VERSION 4.4
- NCACHE to detect presence of Norton Disk cacher.
- PCCACHE to detect presence of PCTools cache.
- SMARTDRIV no longer gives false positives for NCACHE and PCCACHE.
WHAT'S NEW IN VERSION 4.3
- SMARTDRV test for caching program.
- fancier QEMM test that would not be fooled by a file of the same
name as the device driver.
WHAT'S NEW IN VERSION 4.2
- bug in ASSIGN test fixed.
WHAT'S NEW IN VERSION 4.1
- released to BIX 1991 June 25.
- KEYB documented and fixed to work under DOS 5.0.
- QEMM serious bug in test, just exits. Now fixed.
WHAT'S NEW IN VERSION 4.0
- released to BIX 1991 June 14
- mostly fixes in the documentation. References to DOS 5, Share,
Windows problems.
WHAT'S NEW IN VERSION 3.9
- released to the Vancouver PC User Society
WHAT'S NEW IN VERSION 3.8
- code changed in the HANDLES test to make it DOS 2.1 compatible.
WHAT'S NEW IN VERSION 3.7
- both fast and slow 386 vs 486 test. The fast test works fine under
Windows but fails under some virtual memory managers such as
Compaq's expanded memory manager.
- the generic /DOS5.0 test now properly displays DR DOS when run under
DR DOS.
WHAT'S NEW IN VERSION 3.6
- detect more types of PS/2 BIOS and discriminate them from AT BIOSes
with the same model type.
- added parameters so you can request or avoid PS2 and EXOTIC.
- added version checks on many interrupt calls to not even try the
call unless the DOS version is high enough. This should make the
code as a whole more robust on old DOS versions.
- use of documented ASSIGN test rather than undocumented one. This
should make the test more robust on non-standard DOS versions.
- consistent wording -- NOT DETECTED used throughout rather than "NOT
PRESENT" since many tests can give false negatives.
- Fixed bug in the test for PCDOS Version. (I inadvertently deleted
two lines of the routine.)
- new test to discriminate WIN3R from WIN3S.
WHAT'S NEW IN VERSION 3.5
- new HANDLES:15 parameter to ensure there are sufficient file
handles.
- ALL.BAT to compile the SNIFF, AVOID and NEED automatically.
- divide overflow bug fixed. The Divide-by-10 routine failed to
consider dividing 640K by 10 would trigger overflow.
- command line of all blanks now treated identically to a null command
line.
- the CPU type determining tests that measure the instruction pre-
fetch queue (PIQ) length are now done four times, hopefully to
sidestep some of the random effects of DMA refresh.
- even better code to detect a non-functioning BIO int 15 during the
extended RAM test.
WHAT'S NEW IN VERSION 3.4
- new DEBUG command to turn on debugging register dumps.
- new PCDOS test that should not be confused by DRDOS.
- better code to guard against non-functioning BIOS routines in the
extended RAM determination.
WHAT'S NEW IN VERSION 3.3
- this version has debugging code to dump registers at various points
during the NEED C: and NEED EXP:40K commands. The intent is to
track down the source of division overflow and freezing up in Compaq
DOS and DR DOS.
- new DOCs warning people of the difference between FREE RAM and total
RAM.
WHAT'S NEW IN VERSION 3.2
- credits added in the source code for all the methods used.
- new cleaner Btrieve Test.
- new MSDOS test that does not get confused by the presence of DRDOS.
WHAT'S NEW IN VERSION 3.1
- fix problem with 486 appearing as an SX. Reported by Tfrost.
- change word "prefix" to "suffix" in the docs.
- fix bug in test for ASSIGN installed. Reported by MKropp.
- new way of testing BIOS -- using machine model bytes. Should fix
problems with exotic clones with strange CMOS. Problems reported by
aGurski and tFrost.
- two new BIOS types: EXOTIC and PS2.
WHAT'S NEW IN VERSION 3.0
- first version released to the public.
- new QRAM test.
- new parameter SLOW to force slow tests.
- shorten the SX test under windows.
WHAT'S NEW IN VERSION 2.5
- better PCDOS discrimination test. Now uses SET COMSPEC to guess the
boot drive.
WHAT'S NEW IN VERSION 2.4
- code to avoid crashing in BIOS-deficient machines.
- commas and decimal points now work, even when your DOS has bugs and
does not support the Country separators.
- more sensitive BIOS type test to avoid false positives on XT. It
now checks that the month in CMOS is in the range 1..12 for ATs.
- tweaked code so that NEC V30 and V20 detected even when DMA refresh
interferes with the test.
WHAT'S NEW IN VERSION 2.3
- yet another new improved DESQ test. We now detect DESQ version.
WHAT'S NEW IN VERSION 2.2
- better test for DESQview. Some DOSes sneak around the old one.
- new way of handling the default suffixes for AVOID so that things
like AVOID WINDOWS gives the effect you intend.
WHAT'S NEW IN VERSION 2.1
- detect DRMDOS as /DRDOS
- new ANSI.SYS detector for Olivetti, fix Agurski's bug.
- simpler /WINDOWS test
- remove debug code
- better /486 test.
- SNIFF to display without having to specify what you want.
- new tests BIOS, CPU, NPX, WINDOWS and WEEKDAY primarily for SNIFF.
- more sensitive PC vs MS DOS test.
WHAT'S NEW IN VERSION 2.0
- better /80286 test
- better SX vs DX test, however, we still use the old test under
Windows 3.0 extended.
- run the SX vs DX test longer under Windows trying to average out the
time slicing effects.
- Separate tests for Windows and non-Windows.
- Faster /REAL test that does not do a full CPU determination.
- add code for XT BIOSes that have no INT 15 support whatsoever so
that EXT:1+ gives 0. Fixes M.Love's bug.
- inadvertently cleared up Agurski's /DESQview bug.
WHAT'S NEW IN VERSION 1.9
- /WIN3E erroneously reported as version 4, now fixed.
- VCPI test now returns 0 if running under WIN3E to avoid
crashing. Windows does not like programs asking about VCPI.
- new test to discriminate an 80286 from an 80386 that works
even under Windows 386 enhanced mode. Windows enhanced mode
interfered with the old test.
- NEED no longer turns off DMA refresh. It caused some machines
to freeze.
WHAT'S NEW IN VERSION 1.8
- XT vs AT test now works at all times of day. It used to think ATs
were XTs after 6 PM at night. (It turns out the clock is coded in
BCD and I thought it was coded in binary).
WHAT'S NEW IN VERSION 1.7
- insert manual DMA refresh while automatic DMA turned off.
- Correct a bug in QRAM that caused freezing on some machines.
- Correct a bug in VCPI: test that caused freezing on some machines.
- try CMOS test without High bit, to see if it works on Terje's
machine.
- Guess C: as boot drive when boot drive unknown, in attempt to tell
MS DOS and PC DOS apart.
WHAT'S NEW IN VERSION 1.6
- add begin/end critical section on CPU timing loop to stop DESQview
from meddling during tests. Should more accurately discriminate SX
DX 486 CPUs.
- experimental code in Test for DESQview to it if it bypasses DOS bug
giving false positive tests.
- new ANSI.SYS test that should detect things like DVANSI.SYS and
ANSI.SYS in pre-DOS 4.00 that eluded the earlier test.
- safer VCPI test, tests for EMS driver first.
- turn off DMA refresh during queue length and SX timing test for more
accurate results.
- DRDOS version number test added.
- LAN test no longer fooled by CD-ROM drives masquerading as remote
LAN drives.
- /XT and /AT to test BIOS type.
WHAT'S NEW IN VERSION 1.5
- EXT:400K now includes two kinds of VDISK extended RAM, INT 15 RAM
and XMS RAM in its calculations.
- PERI or PERISCOPE now detects presence of PERISCOPE DEBUGGER
- PERI5.1 or PERISCOPE5.0 now detects periscope version.
- NEED now does reports on the success or failure of all the tests.
You can get rid of this with output redirection.
- OR allows you to continue if any one of a group of tests work.
- 80386-DX and other parameters with dashes in them were changed since
the parser got confused by the dash, thinking it was a suffix.
- more relaxed rules on which suffixes are allowed.
- deleted /P1 /P2 /P3 cpu classes.
- Avoid has more complex defaults for suffixes. They are now
specified on an individual basis for each command.
WHAT'S NEW IN VERSION 1.4
- ANSI detects presence of ANSI.SYS.
- MOUSE detects presence of a mouse.
- SX 386 and 486 now should be properly discriminated.
- Numeric co-processors should be correctly identified.
WHAT'S NEW IN VERSION 1.3
- /VCPI:400K test to test amount of Virtual Control Program Interface
RAM.
- /QRAM to detect Quarterdeck's QRAM.
- /MONTH:12 to check for December.
- /YEAR:1991 to check for year.
- /DAY:31 to check that running an a given day of the month.
REGISTERING
I originally thought I would write NEED in a night, perhaps stretching
to a weekend. It turned out to take an embarrassingly long time.
Sometimes three or four lines of code represent days of digging and
pestering people. Some routines were written all over from scratch
five plus times as I discovered more bugs in BIOSes, DOS variants and
Windows. I like writing free software, but since my company is in
such rough financial shape, I am going to make the program partly free
and partly shareware.
You are free to use NEED.COM, NEED.TXT, SNIFF.COM and AVOID.COM, and
to copy them freely for any purpose but military. If you want the
MASM source code, or the latest version of NEED/AVOID/SNIFF you must
register.
The registration price includes shipping and handling anywhere in the
world. Please send $15 US or $15 CDN cheque, money order or VISA,
(sorry, we don't have authorization to handle any other kinds of
credit card) to:
NEED/AVOID Registrations
Canadian Mind Products
#168 - 1020 Mainland Street
Vancouver, BC CANADA
V6B 2T4
(604) 684-6529 voice.
We can take VISA by phone. Sorry no other credit cards.
(604) 684-5541 fax
You can also contact me on BIX as id ROEDY.
Please mark any bug reports "attention Roedy Green".
-30-